﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Cart.ascx.cs" Inherits="UserControls_Cart" %>
<%@ Register Src="Page.ascx" TagName="Page" TagPrefix="uc1" %>
<%@ Register Assembly="Infragistics2.WebUI.WebDataInput.v7.1, Version=7.1.20071.40, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.WebDataInput" TagPrefix="igtxt" %>
<%@ Register Assembly="Infragistics2.WebUI.UltraWebGrid.v7.1, Version=7.1.20071.40, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.UltraWebGrid" TagPrefix="igtbl" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="js/Shop.js"></script>
<script language="javascript" type="text/javascript">

    function updateQuantity(obj)//修改数量
    {    
        var CartType = document.getElementById('<%=this.hCartType.ClientID %>').value;  //哪个购物车        
        var proid = document.getElementById('<%=this.hID.ClientID%>').value;
        var quantity = obj;
        
        if(CartType == "carList2")
        {
            Common.updateQuantity(proid,quantity,"carList2");
            window.location="Default.aspx?PN=cart&CartType=carList2";
        }
        else
        {
            Common.updateQuantity(proid,quantity,"carList");
            window.location="Default.aspx?PN=cart";
        }
     }
     
    function reMoveOne(proid)//删除
    {
        var CartType = document.getElementById('<%=this.hCartType.ClientID %>').value;  //哪个购物车
    
        if(CartType == "carList2")
        {
            Common.reMoveOne(proid,"carList2");
            window.location="Default.aspx?PN=cart&CartType=carList2";
        }
        else
        {
            Common.reMoveOne(proid,"carList");
            window.location="Default.aspx?PN=cart";
        }
    }
    function Del()//清空
    {
        var CartType = document.getElementById('<%=this.hCartType.ClientID %>').value;  //哪个购物车
    
        if(CartType == "carList2")
        {
            cookie.Del("carList","/");
            window.location="Default.aspx?PN=cart&CartType=carList2";
        }
        else
        {
            cookie.Del("carList","/");
            window.location="Default.aspx?PN=cart";
        }
    }
</script>

<div>
    <table border="0" cellpadding="0" cellspacing="1" id="tabctr" runat="server" width="545">
        <tr>
            <td bgcolor="#FFFFFF">                
                <table width="100%" border="0" cellspacing="0" cellpadding="0" style="text-align:left;">
                            <tr>
                                <td width="3%" height="35" background="images/UserControls/bgbg.jpg">
                                    <div align="center">
                                        <img src="images/UserControls/dddd.jpg" width="9" height="27" /></div>
                                </td>
                                <td width="97%" background="images/UserControls/bgbg.jpg" class="STYLE3">
                                    <asp:Label ID="lbTitle" runat="server" Text="我的购物车"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td height="1" bgcolor="C5E4FF">
                                </td>
                                <td bgcolor="C5E4FF">
                                </td>
                            </tr>
                        </table>
            </td>
        </tr>
        <tr>
            <td bgcolor="#FFFFFF">
                <div style="height: 10px;">
                </div>
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td>
                            <asp:GridView ID="gvGood" runat="server" AutoGenerateColumns="False" Style="text-align: center"
                                Width="100%" DataKeyNames="ID" OnRowDataBound="gvGood_RowDataBound" AllowPaging="True"
                                OnPageIndexChanging="gvGood_PageIndexChanging">
                                <Columns>
                                    <asp:BoundField DataField="ID" Visible="False" />
                                    <asp:TemplateField HeaderText="商品图片">
                                        <ItemTemplate>
                                            <a href="Default.aspx?PN=goods_details&ID=<%#Eval("ID") %>">
                                                <asp:Image ID="imgGoodPic" runat="server" onerror="this.src='UpFile/Goods/NoPicture.jpg'" Width="80px" Height="80px"
                                                    ImageUrl='<%# Eval("FilePic_Small") %>' /></a>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="GoodNo" HeaderText="商品编号" />
                                    <asp:BoundField DataField="GoodName_CN" HeaderText="商品名称" />
                                    <asp:HyperLinkField DataTextField="GoodNorm" HeaderText="商品规格" />
                                    <asp:HyperLinkField DataTextField="GoodColor" HeaderText="商品颜色" />
                                    <asp:BoundField DataField="Price_Orig" HeaderText="普通价格" />
                                    <asp:BoundField DataField="Price_Vip" HeaderText="会员价" />
                                    <asp:TemplateField HeaderText="数量">
                                        <ItemTemplate>
                                            &nbsp;<asp:TextBox ID="txtNum" runat="server" Text='<%# Eval("Amount") %>' onkeyup="value=value.replace(/[^\d]/g,'');updateQuantity(this.value)"
                                                Width="39px"></asp:TextBox>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="SumMoney" HeaderText="金额" />
                                    <asp:TemplateField HeaderText="删除">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            &nbsp;<asp:ImageButton ID="ibDelete" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" id="tdtotal" runat="server">
                            <asp:Label ID="Label1" runat="server" Text="合计:" ></asp:Label>
                            <asp:Label ID="lbSum" runat="server" Text="0"></asp:Label>
                            <asp:Label ID="Label2" runat="server" Text="元" ></asp:Label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td bgcolor="white" height="28" valign="middle">
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td valign="middle">
                        &nbsp;
                        </td>
                        <td  style="height: 24px" valign="middle" id="tdBottom" runat="server">
                            <a href="#">
                                <img src="http://about" border="0" onclick="Del()" id="imgdel" runat="server" /></a>&nbsp;&nbsp; <a href="#">
                                    <img src="http://about" border="0" onclick="window.location='Default.aspx'" id="imggood" runat="server" /></a>
                            &nbsp;&nbsp;<asp:ImageButton ID="ibNext" runat="server" 
                                OnClick="ibNext_Click1" />
                        </td>
                    </tr>
                </table>
                <div style="height: 7px;">
                </div>
            </td>
        </tr>
    </table>
</div>

<input id="hID" type="hidden" runat="server" />
<asp:HiddenField ID="hCartType" runat="server" /> <!-- 哪个购物车 -->
